package itheima;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;

import java.util.concurrent.TimeUnit;

@SpringBootTest
public class Redistest {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Test
    public void test() {
        stringRedisTemplate.opsForValue().set("name", "zhangsan");
        stringRedisTemplate.opsForValue().set("age", "18",15, TimeUnit.SECONDS);
        System.out.println(stringRedisTemplate.opsForValue().get("name"));
    }
}
